package com.ssm.maven.service.impl;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import com.ssm.maven.domain.Users;
import com.ssm.maven.mapper.UsersMapper;
import com.ssm.maven.service.UsersService;

@Service
public class UsersServiceImpl implements UsersService{

	@Autowired
	private UsersMapper usersMapper;
/*
 * ע��d
 */
	public int logonUsers(Users users) {
		
		int logonUsers = usersMapper.logonUsers(users);
		
		return logonUsers;
		
	}
	
/*
 * ��¼��֤d
 * ����֤�ֻ���
 * ����ȷ�򷵻�0��û�д��ֻ��ţ�
 * ��ȷ��֤����
 * ����ȷ����1��������ֻ��ţ��������벻�ԣ�
 * ��ȷ�򷵻�2����¼�ɹ���
 */
	public int loginBy_u_tel(int u_tel,String u_pwd) {

		
		Users loginBy_u_tel = usersMapper.loginBy_u_tel(u_tel);
		if (loginBy_u_tel!=null) {
			
			if (loginBy_u_tel.getU_pwd().equals(u_pwd)) {
				return 2;
			} else {
				return 1;
			}
			
		}else {
			return 0;
		}
	}
	


}
